package thinkingJava.chapter12;

class OneException extends Exception {
	public OneException(String s) {
		super(s);
	}
}
class TwoException extends Exception {
	public TwoException(String s) {
		super(s);
	}
}
public class RethrowNew {
	public static void f() throws OneException {
		System.out.println("originaling throw exception from f()");
		throw new OneException("throw from f()");
	}
	public static void main(String[] args) {
		try {
			try {
				f();
			} catch (OneException e) {
				System.out.println("innner try : ");
				e.printStackTrace(System.out);
				throw new TwoException("the second Exception :");
			}
		} catch (TwoException e) {
			System.out.println("Caught the exception in the outer try!");
			e.printStackTrace(System.out);
		}
	}
}
